import App from './App'

// #ifndef VUE3
import Vue from 'vue'
import uView from 'uview-ui'
import store from './store'
import Cache from './utils/cache'
import util from 'utils/util'
import configs from './config/app.js'
import socket from "./utils/socket"

// 配置socket
//连接
socket.connect();

/** socket配置结束 **/

Vue.prototype.$util = util;
Vue.prototype.$socket = socket;
Vue.prototype.$config = configs;
Vue.prototype.$Cache = Cache;

Vue.config.productionTip = false
Vue.use(uView)
App.mpType = 'app'
Vue.prototype.formatDate = function (t) {
    t = t || Date.now();
    let time = new Date(t);
    let str = time.getMonth() < 9 ? ('0' + (time.getMonth() + 1)) : (time.getMonth() + 1);
    str += '-';
    str += time.getDate() < 10 ? ('0' + time.getDate()) : time.getDate();
    str += ' ';
    str += time.getHours();
    str += ':';
    str += time.getMinutes() < 10 ? ('0' + time.getMinutes()) : time.getMinutes();
    return str;
};
const app = new Vue({
    ...App,
	store,
	Cache,
})
app.$mount()
// #endif

// #ifdef VUE3
import { createSSRApp } from 'vue'
export function createApp() {
  const app = createSSRApp(App)
  return {
    app
  }
}
// #endif